﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ParangonBiz.Data;
using ParangonBiz.SiteMembership;
using ParangonBiz.Tools;

namespace ParangonBiz.Master
{
    public partial class Common : System.Web.UI.MasterPage
    {
        

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                List<SiteMenuItem> smiList = SiteMenuItem.GetMenuItemsTree(MembershipHelper.MembershipService.IsAuthorizedRequest);

                //foreach (SiteMenuItem siteMenuItem in smiList)
                //{
                //    siteMenuItem.Url = CreateUrlForItem(siteMenuItem.KeyId, siteMenuItem.PageType);
                //}

                rptMainMenu.DataSource = smiList;
                rptMainMenu.DataBind();

                List<SiteContent> sc = SiteContent.ListAllContent((int)EnumHelper.ContentType.License);
                if (sc != null && sc.Count > 0)
                {
                    SiteContent licenseContent = sc.SingleOrDefault();
                    if (licenseContent != null)
                    {
                        lblLicenseTitle.Text = licenseContent.Title;
                        lblLicense.Text = licenseContent.Content;
                    }
                }
            }
        }
    }
}